/*
    This file is part of Slydini.

    Slydini is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Slydini is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Slydini.  If not, see <http://www.gnu.org/licenses/>.
*/
/* 
 * File:   image_structs.h
 * Author: kajetan
 *
 * Created on 28 marzec 2009, 14:20
 */

#ifndef _IMAGE_STRUCTS_H
#define	_IMAGE_STRUCTS_H

#include "libs.h"

template<class T> class Image {
public:
    IplImage* imgp;

    Image(IplImage* img = 0) {
        imgp = img;
    }

    ~Image() {
        imgp = 0;
    }

    void operator=(IplImage* img) {
        imgp = img;
    }

    inline T * operator[](const int rowIndex) {
        return ((T *) (imgp->imageData + rowIndex * imgp->widthStep));
    }
};

typedef struct {
    unsigned char b, g, r;
} RgbPixel;

typedef struct {
    float b, g, r;
} RgbPixelFloat;

typedef Image<RgbPixel> RgbImage;
typedef Image<RgbPixelFloat> RgbImageFloat;
typedef Image<unsigned char> BwImage;
typedef Image<float> BwImageFloat;


#endif	/* _IMAGE_STRUCTS_H */

